In [129]:
char1 = 'h'
Out[129]:
In [130]:
#Convertion
char2 = 'a'
typeof(Int(char2))
Out[130]:
In [131]:
str = "Domo arigato "
str2 = "Mr. Roboto"
str3 = str * str2
println(str3)
#Indexing
println(str[3])
println(str3[end])
println(str3[end-1])
println(str3[11:14])
In [132]:
greet = "Hello"
whom = "world"
print(string(greet, ", ", whom, ".\n"))
#Another way to do the above
println("$greet, $whom")
#interpolating expresions into strings
println("1 + 2 = $(1 + 2)")
#if you want to use the liteal symbol $ you can use a backslash
"Y mis \$50,000 pesos que?"
Out[132]:
In [133]:
println("brain" == "drain")
println("gin" < "tequila")
println("Hello, world." != "Goodbye, world.")
println("1 + 2 = 3" == "1 + 2 = $(1 + 2)")
#You can check where a certain character is in a string
println(search("Pterodactyl",'y'))
println(search("Pterodactyl",'z'))
#You can use contain to check if a string is whithin another string
println(contains("Hello, world.", "world"))
In [134]:
x = r"^\s*(?:#|$)"
typeof(x)
Out[134]:
In [ ]: